﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="Nivdal.SearchForum" Title="" StylesheetTheme="SkinFile" Codebehind="SearchForum.aspx.cs" %>

<asp:Content ID="PageNameContent" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" Text="<%$ Resources:Resource, SearchForum_PageNameLabel %>" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Label ID="ErrorLabel" runat="server" Text="" SkinID="ErrorLabel"></asp:Label>
    <table cellspacing="3">
        <tr>
            <td>
                <asp:Label ID="ForumIdLabel" runat="server" Text='<%# Resources.Resource.Global_ForumId+ ":"%>' SkinID="InfoLabel"></asp:Label>
            </td><td>
                <asp:TextBox ID="ForumIdTextBox" runat="server" MaxLength="12" ValidationGroup="ForumSearch" Width="150px"></asp:TextBox>
            </td>
            <td>
                <asp:Button ID="ForumIdButton" runat="server" ValidationGroup="ForumSearch" Text="<%$ Resources:Resource, Global_Search %>"
                    OnClick="ForumId_Click" CssClass="GreenButtonTextStyle"/>
            </td>
            
        </tr>
        <tr>
            <td colspan="3">
                <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator1" ControlToValidate="ForumIdTextBox"
                    ErrorMessage="Illigal Forum Id" ValidationExpression="^[0-9]{1,128}$" ValidationGroup="NameSearch"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="ForumNameTitleLabel" runat="server" Text='<%# Resources.Resource.Global_ForumName+ ":"%>' SkinID="InfoLabel"></asp:Label> 
            </td><td>    
                <asp:TextBox ID="ForumNameTextBox" runat="server" MaxLength="256" ValidationGroup="ForumNameSearch" Width="150"></asp:TextBox>
            </td>
            <td valign="bottom">
                <asp:Button ID="ForumNameButton2" runat="server" ValidationGroup="ForumSearch" Text="<%$ Resources:Resource, Global_Search %>"
                    OnClick="ForumName_Click" CssClass="GreenButtonTextStyle" />
            </td>
            
        </tr>
        <tr>
            <td colspan="3">
                <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator3" ControlToValidate="ForumNameTextBox"
                    ErrorMessage="Illigal Forum Name" ValidationExpression="^[\s0-9a-zA-Z]{2,256}$"
                    ValidationGroup="ForumSearch"></asp:RegularExpressionValidator>
            </td>
        </tr>
    </table>
    <asp:GridView ID="SearchForumByIdGridView" runat="server" DataSourceID="SearchForumByIdSqlDataSource"
        SkinID="Professional" AutoGenerateColumns="False" AllowPaging="True" Font-Size="13px"
        Visible="false" EnableTheming="True">
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    <asp:Label ID="ForumLabel" runat="server" Text="<%$ Resources:Resource, Global_Forum %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="ForumDetailsHyperLink" runat="server" Text='<%# Eval("ForumName") %>'
                        NavigateUrl='<%# Eval("ForumId", "ForumDetails.aspx?Id={0}") %>' SkinID="HyperLinkSkin"></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <asp:Label ID="NoForumsWereFoundLabel" runat="server" Text="<%$ Resources:Resource, SearchForum_NoForumsWereFoundLabel %>"></asp:Label>
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="SearchForumByIdSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ForumSearchById" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
    <asp:GridView ID="SearchForumByNameGridView" runat="server" DataSourceID="SearchForumByNameSqlDataSource"
        SkinID="Professional" AutoGenerateColumns="False" AllowPaging="True" Visible="false"
        Font-Size="13px" EnableTheming="True">
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    <asp:Label ID="ForumNamesLabel" runat="server" Text="<%$ Resources:Resource, Global_Forum %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="ForumNameHyperLink" runat="server" Text='<%# Eval("ForumName") %>'
                        NavigateUrl='<%# Eval("ForumId", "ForumDetails.aspx?Id={0}") %>' SkinID="HyperLinkSkin"></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
       <asp:Label ID="NoForumsWereFoundLabe2" runat="server" Text="<%$ Resources:Resource, SearchForum_NoForumsWereFoundLabel %>"></asp:Label>
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="SearchForumByNameSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ForumSearchByName" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:LinkButton ID="ToForumHomePage" runat="server" PostBackUrl="~/ForumHomePage.aspx" SkinID="TitleLink">To forum home page</asp:LinkButton>
    <br />
    <asp:LinkButton ID="ToMyConversations" runat="server" PostBackUrl="~/ForumConversations.aspx" SkinID="TitleLink">To my conversations</asp:LinkButton>
</asp:Content>
